package com.easyschool.webservices.adapter;

import java.sql.Date;
import java.text.SimpleDateFormat;

import javax.xml.bind.annotation.adapters.XmlAdapter;

public class WSDateAdapter extends XmlAdapter<String, Date> {


	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
    @Override
    public Date unmarshal(String v) throws Exception {
        return new Date(sdf.parse(v).getTime());
    }

    @Override
    public String marshal(Date v) throws Exception {
        return sdf.format(v);
    }

}
